package com.hs.mesj.socket;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class SocketService {
    public  static   Log log = LogFactory.getLog(SocketService.class);
    public static Map<String,Object> CLT= new HashMap<>();

    public static void  runServer() throws Exception {
        ServerSocket serverSocket = new ServerSocket(Integer.valueOf(ApplicationProUtil.getValue("socket.sport")));
//        ServerSocket serverSocket = new ServerSocket(5208);
        log.info("服务器启动成功");
        while (true) {
            Socket socket= serverSocket.accept();
            log.info("上线通知： " + socket.getInetAddress() + ":" +socket.getPort());
            CLT.put("socket.getInetAddress()",socket.getPort());
            new Thread(new ServerThread(socket)).start();
        }
    }
}